package holdobject;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;

public class Statistics {
    public static void main(String[] args) {
        Random random=new Random(47);
        Map<Integer,Integer> m=new HashMap<Integer, Integer>();
        for (int i = 0; i <10000 ; i++) {
            int r=random.nextInt(30);//键
            Integer in=m.get(r);//返回指定键所对应的值
            m.put(r,in==null?1:in+1);
        }
        System.out.println(m);
    }
}
